import { ElMessage } from "https://unpkg.com/element-plus";

export function checkLoginData() {
    const username = localStorage.getItem("username");
    const password = localStorage.getItem("password");
    const expires = localStorage.getItem("expires");

    if (username && password && expires) {
        const expiresDate = new Date(parseInt(expires));
        const now = new Date();
        if (now < expiresDate) return { username, password };
    }

    // 未登录则跳转回首页
    window.location.href = "/index.html";
    return null;
}
